package com.yyfax.demo.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.yyfax.demo.bo.BaseBo;
import com.yyfax.demo.dao.test.UserDao;
import com.yyfax.framework.common.bean.Result;
import com.yyfax.framework.redis.RedisUtil;

import io.swagger.annotations.ApiParam;

@RestController
@RequestMapping("/test")
public class TestController {
	
		@Resource
		private  UserDao userDao ;

	 	@RequestMapping(value = "/testdemo", method = RequestMethod.POST)
	    @ResponseBody
	    public Result test(@ApiParam(name="BaseBo",value="测试baseBo",required=true)@RequestBody BaseBo baseBo) {
	        Result result = new Result();
	        return result;
	    }
	 	
	 	
	 	@RequestMapping(value = "/getall", method = RequestMethod.GET)
	    @ResponseBody
	    public Result test(HttpServletRequest request, HttpServletResponse response) {
	 		
	 		
	 		System.out.println("   进来了进来了 ！！！！  ");
	        
	        Result result = new Result();
	        
	        result.setData(userDao.selectAll());
	        
	        return result;
	    }
	 	
	 	
	 	
	 	@RequestMapping(value = "/testredis", method = RequestMethod.GET)
	    @ResponseBody
	    public Result testredis(HttpServletRequest request, HttpServletResponse response) {
	 		
	 		
	 		System.out.println("   进来了进来了 ！！！！  ");
	        
	        Result result = new Result();
	       
	        RedisUtil.set("a", "bbbb");
	        
	        
	        System.out.println("  redis test  a = " + RedisUtil.get("a"));
	        
	        return result;
	    }
}
